
<?php
function connettiDb()
{
	mysql_connect('localhost','root','')
	or die('impossibile collegarsi al server');
	
	mysql_select_db('chiedimelo')
	or die ('impossibile collegarsi al database');
}

function domande()
{ 
	connettiDb();
	$sql= "select * from domanda limit 5";
	$result=mysql_query($sql);
	//echo $sql;
	return $result;
}

function risposta($value){
		connettiDb();
		$sql='select * from risposta where '. $value.'=domanda_id';
		$result=mysql_query($sql);		
		return $result;

}

function domanda($value)
{ 
	connettiDb();
	$sql='select * from domanda where '. $value.'=id';
	$result=mysql_query($sql);
	//echo $sql;
	return $result;
}